#! /usr/bin/perl

sub average {
	my $ret;
	foreach (@_) {
		$ret += $_;
	}
	$ret / @_;
}

sub above_average() {
	my $aver = average(@_);
	foreach (@_) {
		if ($_ > $aver) {
			print $_ . "\n";
		}
	}
}

my @fred = &above_average(1..10);
print "\@fred is @fred\n";
print "(Should be 6 7 8 9 10)\n";
my @barney = &above_average(100, 1..10);
print "\@barney is @barney\n";
print "(Should be just 100)\n";
